package fr.umlv.m2.jee.spij.framework.dao.hibernate;

import fr.umlv.m2.jee.spij.framework.dao.IDAO;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;

import java.io.Serializable;
import java.util.List;

/**
 * @param <K> the primary key.
 * @param <T> the type of the object.
 */
public interface IHibernateDAO<K extends Serializable, T> extends IDAO<K, T> {

    /**
     * @return the hibernate session.
     */
    Session getHibernateSession();

    /**
     * @param criteria a list of criterion.
     *
     * @return a list of T object.
     */
    List<T> findByCriteria(Criterion... criteria);

    /**
     * @param instance          an instance of type T.
     * @param excludeProperties the exclude properties.
     *
     * @return a list of object.
     */
    List<T> findByExample(T instance, String[] excludeProperties);
}
